home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1998 October / Macworld (1998-10).dmg / Games World / Hot New Games / Real Pool Demo / DATA / NET.DAT / 00001.ls next >
Encoding:
Text File  |  1998-05-01  |  3.0 KB  |  133 lines

  1. global cwhite, cyellow, gport, playermode, name, identity, name2, lastip
  2.  
  3. on startMovie
  4.   set cwhite to the foreColor of line 1 of field "colors"
  5.   set cyellow to the foreColor of line 2 of field "colors"
  6.   reset()
  7.   initnet()
  8.   repeat with i = 1 to 6
  9.     sound close i
  10.   end repeat
  11.   set the soundLevel to 0
  12.   set the modal of getAt(the windowList, 1) to 1
  13.   tell the stage
  14.     pause()
  15.   end tell
  16. end
  17.  
  18. on stopMovie
  19.   reset()
  20.   XNetShutdown()
  21.   put " " into field "ip"
  22.   put " " into field "chat"
  23.   put " " into field "name"
  24. end
  25.  
  26. on openWindow
  27.   repeat with i = 6 to 0
  28.     set the soundLevel to i
  29.   end repeat
  30. end
  31.  
  32. on closeWindow
  33.   set the soundLevel to 6
  34.   if identity = 0 then
  35.     tell the stage
  36.       continue()
  37.       forget(getAt(the windowList, 1))
  38.     end tell
  39.   else
  40.     closebox()
  41.   end if
  42.   exit
  43.   tell the stage
  44.     go(8)
  45.     continue()
  46.     mainloop()
  47.   end tell
  48. end
  49.  
  50. on closebox
  51.   set lastip to field "ip"
  52.   repeat while not (field "chat" contains "with: ")
  53.     onlineloop()
  54.   end repeat
  55.   repeat with i = 1 to the number of lines in field "chat"
  56.     if line i of field "chat" contains "with: " then
  57.       set yu to the itemDelimiter
  58.       set the itemDelimiter to ":"
  59.       set name2 to item 2 of line i of field "chat"
  60.       set name2 to char 2 to length(name2) - 1 of name2
  61.       set the itemDelimiter to yu
  62.       exit repeat
  63.     end if
  64.   end repeat
  65.   tell the stage
  66.     forget(getAt(the windowList, 1))
  67.   end tell
  68.   if identity <> 0 then
  69.     tell the stage
  70.       go(115)
  71.     end tell
  72.   end if
  73. end
  74.  
  75. on exitFrame
  76.   onlineloop()
  77. end
  78.  
  79. on idle
  80.   onlineloop()
  81. end
  82.  
  83. on reset
  84.   put "0.0.0.0" into field "ip"
  85. end
  86.  
  87. on addme n
  88.   put RETURN after field "chat"
  89.   set the foreColor of line the number of lines in field "chat" of field "chat" to cwhite
  90.   put RETURN & "-Player " & identity & "-" & RETURN & n after field "chat"
  91.   set the foreColor of line the number of lines in field "chat" of field "chat" to cwhite
  92.   set the foreColor of line the number of lines in field "chat" - 1 of field "chat" to cwhite
  93. end
  94.  
  95. on addother n
  96.   puppetSound(1, 11)
  97.   put RETURN after field "chat"
  98.   set the foreColor of line the number of lines in field "chat" of field "chat" to cyellow
  99.   set identityx to not (identity - 1) + 1
  100.   put RETURN & "-Player " & identityx & "-" & RETURN & n after field "chat"
  101.   set the foreColor of line the number of lines in field "chat" of field "chat" to cyellow
  102.   set the foreColor of line the number of lines in field "chat" - 1 of field "chat" to cyellow
  103. end
  104.  
  105. on send n
  106.   global nn
  107.   if the paramCount = 0 then
  108.     set n to field "send"
  109.   end if
  110.   if char 1 of n <> "[" then
  111.     addme(n)
  112.   end if
  113.   set nn to n
  114.   put " " into field "send"
  115.   senddata(string("addchat" && QUOTE & nn & QUOTE))
  116. end
  117.  
  118. on doproc
  119.   global gbuffer
  120.   set yu3 to the itemDelimiter
  121.   set the itemDelimiter to "|"
  122.   repeat with i = 1 to the number of items in gbuffer
  123.     do(string(item i of gbuffer))
  124.     put string(item i of gbuffer)
  125.   end repeat
  126.   set gbuffer to EMPTY
  127.   set the itemDelimiter to yu3
  128. end
  129.  
  130. on addchat n
  131.   addother(n)
  132. end
  133.